<template>
  <el-select v-model="currentValue" filterable placeholder="请选择" @change="changeSelect" >
    <el-option
      v-for="item in alldata"
      :key="item.value"
      :label="item.label"
      :value="item.value">
    </el-option>
  </el-select>
</template>

<script>
  export default {
    props: ['alldata', 'currentSolutionId'],
    data () {
      return {
        currentValue: this.currentSolutionId
      }
    },
    methods: {
      changeSelect (val) {
        // //console.log('currentvalue', this.currentValue)
        this.$emit('change-select', { 'curid': val })
      }
    },
    mounted () {
      // this.currentValue = this.currentSolutionId
      this.$forceUpdate()
    },
    watch: {
      // currentSolutionId: {
      //   handler (newVal, oldVal) {
      //     //console.log('newVal!!!!!!!!!!', newVal)
      //     this.currentValue = newVal
      //
      //   }
      //
      // }
      currentSolutionId: function (newVal, oldVal) {
        this.currentValue = newVal
      }
    }
  }
</script>
